package com.vhall.component.controller.room;

import com.vhall.component.entity.room.vo.*;
import com.vhall.component.plugin.common.annotation.TokenAuth;
import com.vhall.component.service.room.InvestRefRelationService;
import com.vhall.component.service.room.InvestRefService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 投资依据-
 *
 * @author xing.wang
 * @date 2023/8/11
 */
@RestController
@RequestMapping("/v4/invest-ref")
@RequiredArgsConstructor
public class InvestRefController {
    private final InvestRefService refService;
    private final InvestRefRelationService refRelationService;
    /**
     * 创建投资依据
     * @param vo
     * @return
     */
    @TokenAuth
    @PostMapping("/create")
    public Boolean addInvestRef(@Validated AddInvestRefVO vo){
         return  refService.addInvestRef(vo);
    }
    /**
     * 创建投资依据关联
     * @param vo
     * @return
     */
    @TokenAuth
    @PostMapping("/create-relation")
    public Boolean addInvestRefRelation(@Validated AddInvestRefRelationVO vo){
        return  refRelationService.addInvestRefRelation(vo);
    }


    /**
     * 删除投资依据关联
     * @param vo
     * @return
     */
    @TokenAuth
    @PostMapping("/delete-relation")
    public Boolean deleteInvestRefRelation(@Validated DeleteInvestRefRelationRequestVO vo){
        return  refRelationService.deleteInvestRefRelation(vo);
    }
    /**
     * 获取房间关联投资依据 list
     */
    @TokenAuth
    @GetMapping("/relation/list")
    public List<InvestRefResponseVO> getRoomInvestRefRelationList(@Validated RoomInvestRefRelationListRequestVO vo){
        return refService.getRoomInvestRefRelationList(vo);
    }
}
